<ion-view view-title={{moduleTitle}}>
    <ion-nav-buttons side="left">
        <a class="button button-icon ion-arrow-left-c" ng-click="goBack()"></a>
    </ion-nav-buttons>
    <div class="tabs-striped tabs-top">
        <div class="tabs">
            <a ng-if="access.list" ng-class="{'tab-item':true,'active': id }" href="#/{{moduleName}}/list">查看</a>
            <a ng-if="access.add" ng-class="{'tab-item':true,'active': !id }" href="#/{{moduleName}}/0">添加</a>
        </div>
    </div>
    <ion-content class="padding has-tabs-top">
        <form name="detailForm" novalidate="" ng-submit="submitForm(detailForm)">
            <ion-list class="list">
                <insert-address form="detailForm" addressoption="addressOption"></insert-address>

                <label class="item item-input">
                    <span class="input-label">详细地址：</span>
                    <input type="text" name="addr_details" ng-model="detail.addr_details"
                           ng-maxlength="50"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.addr_details.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-50.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">姓名<span style="color:red">*</span>：</span>
                    <input type="text" name="farmer_name" ng-model="detail.farmer_name"
                           required
                           ng-maxlength="10"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.farmer_name.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-10.html"></div>
                </div>

                <label class="item item-radio">
                    <input type="radio" name="gender" value="男" ng-model="detail.gender">
                    <div class="item-content">
                        男
                    </div>
                    <i class="radio-icon ion-checkmark"></i>
                </label>

                <label class="item item-radio">
                    <input type="radio" name="gender" value="女" ng-model="detail.gender">
                    <div class="item-content">
                        女
                    </div>
                    <i class="radio-icon ion-checkmark"></i>
                </label>

                <insert-select option="distributorOption"></insert-select>
                <label class="item item-input">
                <span class="input-label">手机号<span style="color:red">*</span>：</span>
                  <input type="text" name="cell" ng-pattern="/^((13[0-9])|147|(15[0-35-9])|180|182|(18[5-9]))[0-9]{8}$/"
                       ng-model="detail.cell"
                       required
                       ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!--Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':detailForm.cell.$dirty}"
                     ng-messages="detailForm.cell.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-cell-error.html"></div>
                </div>

                <label class="item item-input">
                <span class="input-label">电话号码：</span>
                <input type="text" name="phone" ng-pattern="/^0\d{2,3}-?\d{7,8}$/"
                       ng-model="detail.phone"
                       ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!--Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':detailForm.cell.$dirty}"
                     ng-messages="detailForm.phone.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-phone-error.html"></div>
                </div>
                <label class="item item-input">
                    <span class="input-label">邮箱：</span>
                    <input type="email" name="email" ng-model="detail.email"
                           ng-pattern="/^[a-zA-Z0-9][a-zA-Z0-9._-]*\@[a-zA-Z0-9]+\.[a-zA-Z0-9\.]+$/"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.email.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-email-error.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">农户类型：</span>
                    <input type="text" name="type" ng-model="detail.type"
                           ng-maxlength="10"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.type.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-10.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">耕地面积：</span>
                    <input type="text" name="farm_area" ng-model="detail.farm_area"
                           ng-pattern='/^\d{1,8}([\.]\d{0,2})?$/'
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.farm_area.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-errors.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">土壤种类：</span>
                    <input type="text" name="soil_type" ng-model="detail.soil_type"
                           ng-maxlength="10"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.soil_type.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-10.html"></div>
                </div>

                <label class="item item-input">
                    <span class="input-label">肥沃程度：</span>
                    <input type="text" name="soil_fertility" ng-model="detail.soil_fertility"
                           ng-maxlength="10"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.soil_fertility.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-10.html"></div>
                </div>
                <label class="item item-input">
                    <span class="input-label">备注：</span>
                    <input type="text" name="comments" ng-model="detail.comments"
                           ng-maxlength="50"
                           ng-model-options="{ updateOn: 'default blur', debounce: { default: 500, blur: 0 } }">
                </label>
                <!-- Error Container for Password -->
                <div class="validation-error" ng-class="{'is-dirty':form.password.$dirty}"
                     ng-messages="detailForm.body.$error" role="alert">
                    <div ng-messages-include="templates/system-templates/detail-maxlength-50.html"></div>
                </div>

            </ion-list>
            <button class="button button-full button-positive" ng-disabled="detailForm.$invalid || detailEdit.editDisabled" type="submit">
                {{operation}}
            </button>
        </form>
    </ion-content>

    <script id="revisit-detail-maxlength-200-errors.html" type="text/ng-template">
        <div class="error" ng-message="maxlength">
            <i class="ion-information-circled"></i> 字符长度不能超过200个
        </div>
    </script>
    <script id="revisit-detail-maxlength-50-errors.html" type="text/ng-template">
        <div class="error" ng-message="maxlength">
            <i class="ion-information-circled"></i> 字符长度不能超过50个
        </div>
    </script>
    <!--头部和内容结束-->
</ion-view>